package com.wn.controller;

import com.wn.entity.Manager;
import com.wn.entity.ResponseEntity;
import com.wn.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/rbac_manager")
public class ManagerController {
    @Autowired
    ManagerService managerService;

    @PostMapping("crud")
    public ResponseEntity addOne(@RequestBody Manager manager) {
        return managerService.addOne(manager);

    }

    @DeleteMapping("crud/{id}")
    public ResponseEntity deleteOne(@PathVariable int id) {
        return managerService.deleteOne(id);
    }

    @PutMapping("crud")
    public ResponseEntity update(@RequestBody Manager manager) {
        return managerService.update(manager);
    }

    @GetMapping("crud")
    public ResponseEntity findAll() {
        return managerService.findAll();
    }
}


